home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
snpd9611.zip
/
DELAY.C
< prev
next >
Wrap
Text File
|
1996-11-24
|
804b
|
32 lines
.I 0 5
/* +++Date last modified: 06-Sep-1996 */
/*
** DELAY.C - A portable time delay compatible with Borland's and Watcom's
** delay() function.
.D 1 3
.I 7 3
#if (!defined(__WATCOMC__) && !defined(__TURBOC__)) || (defined(__TURBOC__) \
&& (defined(_Windows) && !defined(__DPMI16) && !defined(__DPMI32__)))
.I 10 15
#ifndef CLOCKS_PER_SEC /* CLOCKS_PER_SEC is ANSI/ISO */
#define CLOCKS_PER_SEC CLK_TCK
#endif
void delay(unsigned short msec)
{
clock_t t0;
unsigned long diff = 0L;
for (t0 = clock(); diff < (unsigned long)msec; )
{
diff = (unsigned long)(clock() - t0);
diff *= 1000L;
diff /= CLOCKS_PER_SEC;
}
.D 11 9
.I 42 2
#endif /* Not Watcom or Borland */